package com.toune.movie.mvp.presenter;


import com.toune.movie.base.Api;
import com.toune.movie.base.BasePresenterImpl;
import com.toune.movie.mvp.contract.LoginContract;
import com.toune.movie.mvp.model.LoginModel;
import com.toune.movie.vo.LoginVo;
import com.toune.movie.vo.VerifyVo;

/**
 * Created by Administrator on 2018/4/26.
 */

public class LoginPresenter extends BasePresenterImpl<LoginContract.View> implements LoginContract.Presenter {
    LoginModel loginModel;

    @Override
    public void attachView(LoginContract.View view) {
        super.attachView(view);
        loginModel = new LoginModel(this);
    }

    @Override
    public void getVery(String phone) {
        loginModel.getVery(phone);
    }

    @Override
    public void login(String phone, String code) {
        loginModel.login(phone, code);
    }

    @Override
    public void setVerify(VerifyVo verifyVo) {
        mView.setVerify(verifyVo);
//        if (verifyVo != null) {
//            mView.showError(verifyVo.getData() + "");
//        }
    }

    @Override
    public void setLogin(LoginVo loginVo) {
        if (loginVo != null) {
            mView.useNightMode(true);
            mView.showError(loginVo.getMsg());
        }
    }
}
